﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LifestyleLightTheme.Data;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace LifestyleLightTheme.VariableTemplate
{
    public class VariableTiles : DataTemplateSelector
    {
       
        public DataTemplate HeaderTileTemplate { get; set; }
        public DataTemplate EventsItemTileTemplate { get; set; }
        public DataTemplate MoviesFirstTileTemplate { get; set; }
        public DataTemplate MoviesSecondTileTemplate { get; set; }
        public DataTemplate BookinTicketMoviesTileTemplate { get; set; }
        public DataTemplate PlaysTileTemplate { get; set; }
        public DataTemplate EventTileTemplate { get; set; }
        public DataTemplate SportTileTemplate { get; set; }
        public DataTemplate mybookingItemTileTemplate { get; set; }
        public DataTemplate ComingSoonTileTemplate { get; set; }
        public DataTemplate FeaturedPlayTileTemplate { get; set; }
        public DataTemplate ScreeningTileTemplate { get; set; }
		public DataTemplate BigScreeningTileTemplate { get; set; }
        
    
      

        protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
        {
            FrameworkElement element = container as FrameworkElement;

            if (element != null && item != null)
            {
				
				 if (item.GetType() == typeof(SampleDataItem))
                {

                if ((item as SampleDataItem).UniqueId.StartsWith("HeaderTile"))
                    return HeaderTileTemplate;
                if ((item as SampleDataItem).UniqueId.StartsWith("EventsItemTile"))
                    return EventsItemTileTemplate;
                if ((item as SampleDataItem).UniqueId.StartsWith("MoviesFirstTile"))
                    return MoviesFirstTileTemplate;
                if ((item as SampleDataItem).UniqueId.StartsWith("MoviesSecondTile"))
                    return MoviesSecondTileTemplate;
                if ((item as SampleDataItem).UniqueId.StartsWith("BookinTicketMoviesTile"))
                    return BookinTicketMoviesTileTemplate;
                if ((item as SampleDataItem).UniqueId.StartsWith("PlaysTile"))
                    return PlaysTileTemplate;
                if ((item as SampleDataItem).UniqueId.StartsWith("EventTile"))
                    return EventTileTemplate;
                if ((item as SampleDataItem).UniqueId.StartsWith("SportTile"))
                    return SportTileTemplate;
                if ((item as SampleDataItem).UniqueId.StartsWith("mybookingItemTile"))
                    return mybookingItemTileTemplate;

             }

                else if (item.GetType() == typeof(EventsDataItem))
                {
                    if ((item as EventsDataItem).UniqueId.StartsWith("HeaderTile"))
                    return HeaderTileTemplate;
                    if ((item as EventsDataItem).UniqueId.StartsWith("EventsItemTile"))
                    return EventsItemTileTemplate;
                    if ((item as EventsDataItem).UniqueId.StartsWith("ComingSoonTile"))
                    return ComingSoonTileTemplate;
                    if ((item as EventsDataItem).UniqueId.StartsWith("FeaturedPlayTile"))
                    return FeaturedPlayTileTemplate;
               
				}


                 else if (item.GetType() == typeof(FeaturedMovieDataItem))
                 {

                     if ((item as FeaturedMovieDataItem).UniqueId.StartsWith("HeaderTile"))
                         return HeaderTileTemplate;
                     if ((item as FeaturedMovieDataItem).UniqueId.StartsWith("EventsItemTile"))
                         return EventsItemTileTemplate;
                     if ((item as FeaturedMovieDataItem).UniqueId.StartsWith("ScreeningTile"))
                         return ScreeningTileTemplate;
					 if ((item as FeaturedMovieDataItem).UniqueId.StartsWith("BigScreeningTile"))
                         return BigScreeningTileTemplate;

                 }

                 else if (item.GetType() == typeof(BookingDataItem))
                 {

                     if ((item as BookingDataItem).UniqueId.StartsWith("HeaderTile"))
                         return HeaderTileTemplate;
                     if ((item as BookingDataItem).UniqueId.StartsWith("mybookingItemTile"))
                         return mybookingItemTileTemplate;
                     

                 }
			}
            return base.SelectTemplateCore(item, container);
        }

    }
}
